package com.example.animation;

import android.animation.TimeInterpolator;

/**
 * Created by android on 2017/9/7.
 */

public class MyTimeInterpolator implements TimeInterpolator {
    @Override
    public float getInterpolation(float input) {
        /**
         * input 0-1动画执行的百分比
         * result 百分比下对应的速度
         */
        float result;
        if (input <= 0.5) {
            result = (float) (Math.sin(Math.PI * input)) / 2;
        } else {
            result = (float) (2 - Math.sin(Math.PI * input)) / 2;
        }
        return result;
    }
}
